const str = '   hhhh   hhhh   ....'

function trim(str) {
  console.log(str.replace(/\s+/g,''));
  return str.replace(/\s+/g,'')
}
trim(str)

function trimStart(str){
  console.log(str.replace(/^\s+/,''));
}
trimStart(str)

function trimEnd(str){
  console.log(str.replace(/\s+$/,''));
}
trimEnd(str)

function trimStart(str){
  return str.replace(/^\s+/,'')
}

function trimEnd(str){
  return str.replace(/\s+$/,'')
}


function trim(str){
  return str.replace(/\s+/g,'')
}



